<?php
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| adminapi Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('error','ExtendController@SaveErrorLogger');

// 添加商品
Route::get('addshop','ExtendController@createList');
Route::get('start','ExtendController@buy');

//api
$api = app('Dingo\Api\Routing\Router');

$api->version('adminv1',["namespace" => "App\Http\Admin\Controllers"],function ($api) {

    //,'middleware'=>['refresh.token']
    $api->group(['prefix' => 'admin','middleware'=>['refresh.token']], function ($api) {
        $api->post('getuserinfo', 'LoginController@getuserinfo');//获取用户权限
    });//需要登录访问的

    $api->group(['prefix' => 'admin'], function ($api) {
        $api->post('login', 'LoginController@login');//登录
        $api->post('logout', 'LoginController@logout');//退出登录
    });//不需登录访问
});
